﻿using System;
using System.Reflection;
using WooCoo.Tools;

namespace WooCoo.ObjectModel.ManagedProperty
{
    internal class DefaultPropertyInfoFactory : IPropertyInfoFactory
    {
        public DefaultPropertyInfoFactory()
        {
        }

        public PropertyInfo<T> Create<T>(Type containingType, string name, T defaultValue, string displayName)
        {
            return new PropertyInfo<T>(name, defaultValue, displayName);
        }


        public PropertyInfo<T> Create<T>(PropertyInfo property)
        {
            return Create<T>(property.DeclaringType, property.Name, default(T), TypeHelper.GetFriendlyNameFromAttributes(property));
        }
    }
}
